package com.wangshouyu.mp.menu;

import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.gson.annotations.SerializedName;

import java.util.Objects;

/**
 * @author 王守钰
 * @date 2020年12月06日 22:39:21
 * @description: 自定义菜单
 */
public class CustomMenu extends Menu{

    /**
     * 匹配规则
     */
    @SerializedName(value = "matchrule")
    @JsonProperty(value = "matchrule")
    @JSONField(name = "matchrule")
    private MatchRule matchRule;

    public MatchRule getMatchRule() {
        return matchRule;
    }

    public void setMatchRule(MatchRule matchRule) {
        this.matchRule = matchRule;
    }

    @Override
    public boolean equals(Object o) {
        if (this == o) {
            return true;
        }
        if (o == null || getClass() != o.getClass()) {
            return false;
        }
        if (!super.equals(o)) {
            return false;
        }
        CustomMenu that = (CustomMenu) o;
        return Objects.equals(matchRule, that.matchRule);
    }

    @Override
    public int hashCode() {
        return Objects.hash(super.hashCode(), matchRule);
    }

    @Override
    public String toString() {
        return "CustomMenu{" +
                "matchRule=" + matchRule +
                '}';
    }
}
